import 'package:flutter_test/flutter_test.dart';
import 'package:common_lib_plugin/common_lib_plugin.dart';
import 'package:common_lib_plugin/common_lib_plugin_platform_interface.dart';
import 'package:common_lib_plugin/common_lib_plugin_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockCommonLibPlatform
    with MockPlatformInterfaceMixin
    implements CommonLibPluginPlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');
}

void main() {
  final CommonLibPluginPlatform initialPlatform = CommonLibPluginPlatform.instance;

  test('$MethodChannelCommonLibPlugin is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelCommonLibPlugin>());
  });

  test('getPlatformVersion', () async {
    CommonLibPlugin commonLibPlugin = CommonLibPlugin();
    MockCommonLibPlatform fakePlatform = MockCommonLibPlatform();
    CommonLibPluginPlatform.instance = fakePlatform;

    expect(await commonLibPlugin.getPlatformVersion(), '42');
  });
}
